﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Diagnostics;
using Jobping.ShortUrls.Models;

namespace Jobping.ShortUrls.Test
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void EncodeTest()
        {
            ShortUrlEncoder encoder = new ShortUrlEncoder();

            Dictionary<long, string> encodesDict = new Dictionary<long, string>();
            Dictionary<string, long> decodesDict = new Dictionary<string, long>();

            for (int i = 9000; i < 10000; i++)
            {
                string encodedValue = encoder.Encode(i);
                encodesDict.Add(i, encodedValue);
                decodesDict.Add(encodedValue, i);
            }

            foreach (var key in decodesDict.Keys)
            {
                string encoddValue = key;
                long decodedValue = encoder.Decode(key);
                Assert.AreEqual(decodedValue, decodesDict[key]);
            }
        }
    }
}
